/*
 * Copyright (c) 2024. hallele, Inc All rights reserved.
 */

package cn.hallele.infrastructure.message.serialization;

import cn.hallele.infrastructure.message.util.CodecUtil;
import org.apache.kafka.common.serialization.Serializer;

/**
 * hallele_mc_core
 *
 * @author anle5
 * @since 2024/9/11 23:30
 */
public class ByteSerializer implements Serializer<Object> {
    /**
     * Convert {@code data} into a byte array.
     *
     * @param topic topic associated with data
     * @param data  typed data
     * @return serialized bytes
     */
    @Override
    public byte[] serialize(String topic, Object data) {
        return CodecUtil.bean2Byte(data);
    }
}
